// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import * as XLSX from 'xlsx'

import 'xe-utils'
import VXETable from 'vxe-table'
import 'vxe-table/lib/style.css'
import vueXlsxTable from 'vue-xlsx-table'
import fileDownload from 'js-file-download'

Vue.use(vueXlsxTable, { rABS: false })






/* import VueI18n from 'vue-i18n' */
/* import { messages } from './components/common/i18n'; */

Vue.prototype.$axios = axios;


/* axios.defaults.baseURL = '/zbApi'; */
/* axios.defaults.headers.post['Content-Type'] = 'application/json' */


/* Vue.use(VueI18n); */
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import '@/assets/iconfont/iconfont.css';
import '@/assets/css/top.css'
import '@/assets/css/tab.css'

import Loading from '@/utils/loading'
Vue.prototype.$loading = Loading
Vue.use(ElementUI);
Vue.use(XLSX)
Vue.use(VXETable)


Vue.config.productionTip = false

//使用钩子函数对路由进行权限跳转
router.beforeEach((to, from, next) => {
  const role = localStorage.getItem('token');
  if (!role && to.path !== '/login' && to.path !== '/regist' && to.path !== '/forget') {
    next('/login');
  } else if (to.path === '/regist') {
    next();
  } else if (to.path === '/forget') {
    next();
  } else {
    next()
  }
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
